package com.zmn.plat.business.impl.channel;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.zmn.common.dto.StatusDTO;
import com.zmn.plat.business.interfaces.channel.ChannelInterfaceBService;
import com.zmn.plat.model.entity.channel.ChannelInterface;
import com.zmn.plat.services.interfaces.channel.ChannelInterfaceService;

/**
 * 描述:ChanneInterfacelBServiceImpl
 *
 * @author tanghongjun
 * @since: 2018/10/16 17:56
 */
@Service
public class ChanneInterfacelBServiceImpl implements ChannelInterfaceBService {
    @Resource
    protected ChannelInterfaceService channelInterfaceService;

    @Override
    public Integer updateStatus(Integer interfaceId, Integer status, String updater) {
        ChannelInterface channelInterface = new ChannelInterface();
        channelInterface.setChannelId(interfaceId);
        channelInterface.setStatus(status);
        channelInterface.setUpdater(updater);
        return this.updateStatus(channelInterface);
    }

    @Override
    public Integer updateStatus(ChannelInterface channelInterface) {

        int pos = channelInterfaceService.updateStatus(channelInterface);

        return pos;
    }

    @SuppressWarnings("Duplicates")
    @Override
    public Integer updateStatusBatch(List<Integer> interfaceIds, Integer status, String updater) {
        StatusDTO dto = new StatusDTO();
        dto.setIds(interfaceIds);
        dto.setStatus(status);
        dto.setUpdater(updater);

        return this.updateStatusBatch(dto);
    }

    @Override
    public Integer updateStatusBatch(StatusDTO dto) {

        int pos = channelInterfaceService.updateStatusBatch(dto);

        return pos;
    }
}
